import 'package:elephant_fish/TRTCLiveRoomDemo/model/TRTCLiveRoomDef.dart';
import 'package:elephant_fish/model/gift_entity.dart';
import 'package:elephant_fish/model/user_info_entity.dart';
import 'package:elephant_fish/util/size_util.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class GiftList extends StatelessWidget {
  final GiftEntity giftEntity;
  final UserInfoEntity userInfoEntity;

  const GiftList({Key key, this.giftEntity, this.userInfoEntity})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Row(
      children: [
        Padding(
          padding: EdgeInsets.only(top: SizeUtil.px(30)),
          child: Container(
            decoration: BoxDecoration(
                color: Color(0x35ff2d8f),
                borderRadius:
                    BorderRadius.all(Radius.circular(SizeUtil.px(35)))),
            child: Row(
              children: [
                Align(
                  alignment: Alignment.centerLeft,
                  child: Padding(
                    padding: EdgeInsets.only(left: SizeUtil.px(5)),
                    child: CircleAvatar(
                      radius: SizeUtil.px(30),
                      backgroundImage: NetworkImage(
                        userInfoEntity == null
                            ? 'https://imgcache.qq.com/operation/dianshi/other/5.ca48acfebc4dfb68c6c463c9f33e60cb8d7c9565.png'
                            : userInfoEntity.avatar == ''
                                ? 'https://imgcache.qq.com/operation/dianshi/other/5.ca48acfebc4dfb68c6c463c9f33e60cb8d7c9565.png'
                                : 'http://119.28.131.94:82' +
                                    userInfoEntity.avatar,
                      ),
                    ),
                  ),
                ),
                Padding(
                  padding: EdgeInsets.only(left: SizeUtil.px(8)),
                  child: Column(
                    children: [
                      SizedBox(
                        height: SizeUtil.px(8),
                      ),
                      Text(
                        userInfoEntity == null
                            ? '还未设置名字'
                            : userInfoEntity.nickname == ''
                                ? '还未设置名字'
                                : userInfoEntity.nickname,
                        style: TextStyle(
                            fontSize: SizeUtil.px(26),
                            color: Color(0xffffffff)),
                      ),
                      SizedBox(
                        height: SizeUtil.px(7),
                      ),
                      Text(
                        '送了' + giftEntity.name,
                        style: TextStyle(
                            fontSize: SizeUtil.px(20),
                            color: Color(0xffffffff)),
                      ),
                      SizedBox(
                        width: SizeUtil.px(10),
                      ),
                    ],
                  ),
                ),
              ],
            ),
          ),
        ),
        SizedBox(width: SizeUtil.px(10),),
        Image.network('http://119.28.131.94:82' + giftEntity.icon,width: SizeUtil.px(132),)
      ],
    );
  }
}
